package org.balthie.cal.core;

public abstract class AbsInputer implements IInputer {

	protected String displayName;

	protected String content;

	// 按键对象 所属的 计算器对象实例
	AbsCalculator cal;

	protected AbsInputer(String displayName, ICalculator cal) {
		super();
		this.displayName = displayName;
		this.cal = (AbsCalculator) cal;
	}
	
	protected abstract void postOnClick();
	
	protected abstract void afterOnClick();

	@Override
	public String getDisplayName() {
		return displayName;
	}
	
	@Override
	public void onClick() {
		this.postOnClick();
		AbsCalculator absCal = (AbsCalculator) this.cal;
		absCal.onInput(this);
		this.afterOnClick();
	}
	
	protected void println(Object ...args)
	{
		this.cal.println(args);
	}
	
	protected void print(Object ...args)
	{
		this.cal.print(args);
	}
}
